Produced by Araxis Merge on 2021-05-13 09:09:05 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | /Applications/Ampps/www/Porto 3.2.2/Theme Files/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js/view | layer.js | 2020-08-12 02:10:16 +0000 |
| 2 | /Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js/view | layer.js | 2021-02-23 01:54:30 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 7 | 1006 |
| Changed | 3 | 8 |
| Inserted | 0 | 0 |
| Removed | 3 | 3 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | /** | 1 | /** | |||
| 2 | * Mageplaza | 2 | * Mageplaza | |||
| 3 | * | 3 | * | |||
| 4 | * NOTICE OF LICENSE | 4 | * NOTICE OF LICENSE | |||
| 5 | * | 5 | * | |||
| 6 | * This source file is subject to the Mageplaza.com license sliderConfig is | 6 | * This source file is subject to the Mageplaza.com license sliderConfig is | |||
| 7 | * available through the world-wide-web at this URL: | 7 | * available through the world-wide-web at this URL: | |||
| 8 | * https://www.mageplaza.com/LICENSE.txt | 8 | * https://www.mageplaza.com/LICENSE.txt | |||
| 9 | * | 9 | * | |||
| 10 | * DISCLAIMER | 10 | * DISCLAIMER | |||
| 11 | * | 11 | * | |||
| 12 | * Do not edit or add to this file if you wish to upgrade this extension to newer | 12 | * Do not edit or add to this file if you wish to upgrade this extension to newer | |||
| 13 | * version in the future. | 13 | * version in the future. | |||
| 14 | * | 14 | * | |||
| 15 | * @category Mageplaza | 15 | * @category Mageplaza | |||
| 16 | * @package Mageplaza_LayeredNavigation | 16 | * @package Mageplaza_LayeredNavigation | |||
| 17 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | 17 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | |||
| 18 | * @license https://www.mageplaza.com/LICENSE.txt | 18 | * @license https://www.mageplaza.com/LICENSE.txt | |||
| 19 | */ | 19 | */ | |||
| 20 | 20 | |||||
| 21 | define([ | 21 | define([ | |||
| 22 | 'jquery', | 22 | 'jquery', | |||
| 23 | 'Mageplaza_AjaxLayer/js/action/submit-filter', | 23 | 'Mageplaza_AjaxLayer/js/action/submit-filter', | |||
| 24 | 'Magento_Catalog/js/price-utils', | 24 | 'Magento_Catalog/js/price-utils', | |||
| 25 | 'jquery/ui', | |||||
| 26 | 'accordion', | 25 | 'accordion', | |||
| 27 | 'productListToolbarForm' | 26 | 'productListToolbarForm' | |||
| 28 | ], function ($, submitFilterAction, ultil) { | 27 | ], function ($, submitFilterAction, ultil) { | |||
| 29 | "use strict"; | 28 | "use strict"; | |||
| 30 | var next_page = ""; | 29 | var next_page = ""; | |||
| 31 | var loading = false; | 30 | var loading = false; | |||
| 32 | var infinite_loaded_count = 0; | 31 | var infinite_loaded_count = 0; | |||
| 33 | var active = false; | 32 | var active = false; | |||
| 34 | 33 | |||||
| 35 | $.widget('mageplaza.layer', $.mage.accordion, { | 34 | $.widget('mageplaza.layer', $.mage.accordion, { | |||
| 36 | options: { | 35 | options: { | |||
| 37 | openedState: 'active', | 36 | openedState: 'active', | |||
| 38 | collapsible: true, | 37 | collapsible: true, | |||
| 39 | multipleCollapsible: true, | 38 | multipleCollapsible: true, | |||
| 40 | animate: 200, | 39 | animate: 200, | |||
| 41 | productsListSelector: '#layer-product-list', | 40 | productsListSelector: '#layer-product-list', | |||
| 42 | mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', | 41 | mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', | |||
| 43 | collapsibleElement: '[data-role=ln_collapsible]', | 42 | collapsibleElement: '[data-role=ln_collapsible]', | |||
| 44 | header: '[data-role=ln_title]', | 43 | header: '[data-role=ln_title]', | |||
| 45 | content: '[data-role=ln_content]', | 44 | content: '[data-role=ln_content]', | |||
| 46 | isCustomerLoggedIn: false, | 45 | isCustomerLoggedIn: false, | |||
| 47 | isAjax: true, | 46 | isAjax: true, | |||
| 48 | params: [], | 47 | params: [], | |||
| 49 | active: [], | 48 | active: [], | |||
| 50 | checkboxEl: 'input[type=checkbox]', | 49 | checkboxEl: 'input[type=checkbox]', | |||
| 51 | sliderElementPrefix: '#ln_slider_', | 50 | sliderElementPrefix: '#ln_slider_', | |||
| 52 | sliderTextElementPrefix: '#ln_slider_text_' | 51 | sliderTextElementPrefix: '#ln_slider_text_' | |||
| 53 | }, | 52 | }, | |||
| 54 | 53 | |||||
| 55 | inFinite: function() { | 54 | inFinite: function() { | |||
| 56 | var self = this; | 55 | var self = this; | |||
| 57 | next_page = ""; | 56 | next_page = ""; | |||
| 58 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | 57 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | |||
| 59 | active = true; | 58 | active = true; | |||
| 60 | } | 59 | } | |||
| 61 | $(".pages-items li > a.next").each(function(){ | 60 | $(".pages-items li > a.next").each(function(){ | |||
| 62 | next_page = $(this).attr("href"); | 61 | next_page = $(this).attr("href"); | |||
| 63 | }); | 62 | }); | |||
| 64 | if(!next_page){ | 63 | if(!next_page){ | |||
| 65 | $('.infinite-loader').hide(); | 64 | $('.infinite-loader').hide(); | |||
| 66 | } | 65 | } | |||
| 67 | $(".infinite-loader .btn-load-more").click(function(){ | 66 | $(".infinite-loader .btn-load-more").click(function(){ | |||
| 68 | if(!loading && next_page){ | 67 | if(!loading && next_page){ | |||
| 69 | loading = true; | 68 | loading = true; | |||
| 70 | self.ajaxInfinite(next_page); | 69 | self.ajaxInfinite(next_page); | |||
| 71 | } | 70 | } | |||
| 72 | }); | 71 | }); | |||
| 73 | }, | 72 | }, | |||
| 74 | 73 | |||||
| 75 | ajaxInfinite: function (submitUrl) { | 74 | ajaxInfinite: function (submitUrl) { | |||
| 76 | var self = this; | 75 | var self = this; | |||
| 77 | infinite_loaded_count++; | 76 | infinite_loaded_count++; | |||
| 78 | $('.infinite-loader .btn-load-more').hide(); | 77 | $('.infinite-loader .btn-load-more').hide(); | |||
| 79 | $('.infinite-loader .loading').show(); | 78 | $('.infinite-loader .loading').hide(); | |||
| 80 | $.ajax({ | 79 | $.ajax({ | |||
| 81 | url: submitUrl, | 80 | url: submitUrl, | |||
| 82 | type: 'get', | 81 | type: 'get', | |||
| 83 | beforeSend: function () { | 82 | beforeSend: function () { | |||
| 84 | $('.infinite-loader .btn-load-more').hide(); | 83 | $('.infinite-loader .btn-load-more').hide(); | |||
| 85 | $('.infinite-loader .loading').show(); | 84 | $('.infinite-loader .loading').show(); | |||
| 86 | }, | 85 | }, | |||
| 87 | success: function (res) { | 86 | success: function (res) { | |||
| 88 | loading = false; | 87 | loading = false; | |||
| 89 | var $products = $(res.products); | 88 | var $products = $(res.products); | |||
| 90 | if (res.backUrl) { | 89 | if (res.backUrl) { | |||
| 91 | window.location = res.backUrl; | 90 | window.location = res.backUrl; | |||
| 92 | return; | 91 | return; | |||
| 93 | } | 92 | } | |||
| 94 | if($products){ | 93 | if($products){ | |||
| 95 | $products.each(function(i,el){ | 94 | $products.each(function(i,el){ | |||
| 96 | if($(el).hasClass('products-grid')){ | 95 | if($(el).hasClass('products-grid')){ | |||
| 97 | var items_grid = $(this).find('.product-items .item'); | 96 | var items_grid = $(this).find('.product-items .item'); | |||
| 98 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | 97 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | |||
| 99 | $(self.options.productsListSelector).trigger('contentUpdated'); | 98 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 100 | } | 99 | } | |||
| 101 | if($(el).hasClass('products-list')){ | 100 | if($(el).hasClass('products-list')){ | |||
| 102 | var items_list = $(this).find('.product-items .item'); | 101 | var items_list = $(this).find('.product-items .item'); | |||
| 103 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | 102 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | |||
| 104 | $(self.options.productsListSelector).trigger('contentUpdated'); | 103 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 105 | } | 104 | } | |||
| 106 | if($(el).hasClass('toolbar-products')){ | 105 | if($(el).hasClass('toolbar-products')){ | |||
| 107 | if($(this).find('.pages a.next').length > 0){ | 106 | if($(this).find('.pages a.next').length > 0){ | |||
| 108 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); | 107 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); | |||
| 109 | }else{ | 108 | }else{ | |||
| 110 | $(self.options.productsListSelector + ' .pages a.next').remove(); | 109 | $(self.options.productsListSelector + ' .pages a.next').remove(); | |||
| 111 | } | 110 | } | |||
| 112 | } | 111 | } | |||
| 113 | }); | 112 | }); | |||
| 114 | if($("form[data-role=tocart-form]").length > 0 | 113 | if($("form[data-role=tocart-form]").length > 0 && !redirect_cart) { | |||
| 115 | $("form[data-role=tocart-form]").catalogAddToCart(); | 114 | $("form[data-role=tocart-form]").catalogAddToCart(); | |||
| 116 | } | 115 | } | |||
| 117 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | 116 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | |||
| 118 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | 117 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | |||
| 119 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | 118 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | |||
| 120 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | 119 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | |||
| 121 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | 120 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | |||
| 122 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | 121 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | |||
| 123 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | 122 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | |||
| 124 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | 123 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | |||
| 125 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | 124 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | |||
| 126 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | 125 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | |||
| 127 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | 126 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | |||
| 128 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | 127 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | |||
| 129 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | 128 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | |||
| 130 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | 129 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | |||
| 131 | var hist = submitUrl; | 130 | var hist = submitUrl; | |||
| 132 | if(submitUrl.indexOf("p=") > -1){ | 131 | if(submitUrl.indexOf("p=") > -1){ | |||
| 133 | var len = submitUrl.length-submitUrl.indexOf("p="); | 132 | var len = submitUrl.length-submitUrl.indexOf("p="); | |||
| 134 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | 133 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | |||
| 135 | var page_param = ""; | 134 | var page_param = ""; | |||
| 136 | if(str_temp.indexOf("&") == -1){ | 135 | if(str_temp.indexOf("&") == -1){ | |||
| 137 | page_param = str_temp; | 136 | page_param = str_temp; | |||
| 138 | } else { | 137 | } else { | |||
| 139 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | 138 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | |||
| 140 | } | 139 | } | |||
| 141 | hist = submitUrl.replace(page_param, ""); | 140 | hist = submitUrl.replace(page_param, ""); | |||
| 142 | } | 141 | } | |||
| 143 | if (typeof window.history.pushState === 'function') { | 142 | if (typeof window.history.pushState === 'function') { | |||
| 144 | window.history.pushState({url: hist}, '', hist); | 143 | window.history.pushState({url: hist}, '', hist); | |||
| 145 | } | 144 | } | |||
| 146 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 145 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 147 | requirejs(['jquery', 'weltpixel_quickview' ], | 146 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 148 | function($, quickview) { | 147 | function($, quickview) { | |||
| 149 | $('.weltpixel-quickview').off('click').on('click', function() { | 148 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 150 | var prodUrl = $(this).attr('data-quickview-url'); | 149 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 151 | if (prodUrl.length) { | 150 | if (prodUrl.length) { | |||
| 152 | quickview.displayContent(prodUrl); | 151 | quickview.displayContent(prodUrl); | |||
| 153 | } | 152 | } | |||
| 154 | }); | 153 | }); | |||
| 155 | }); | 154 | }); | |||
| 156 | } | 155 | } | |||
| 157 | $(".products-grid .weltpixel-quickview").each(function(){ | 156 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 158 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | 157 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | |||
| 159 | }); | 158 | }); | |||
| 160 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | 159 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||
| 161 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | 160 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||
| 162 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | 161 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | |||
| 163 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 162 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 164 | }); | 163 | }); | |||
| 165 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | 164 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||
| 166 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 165 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 167 | }); | 166 | }); | |||
| 168 | } | 167 | } | |||
| 169 | self.initWishlistCompare(); | 168 | self.initWishlistCompare(); | |||
| 170 | next_page = ""; | 169 | next_page = ""; | |||
| 171 | $(".pages-items li > a.next").each(function(){ | 170 | $(".pages-items li > a.next").each(function(){ | |||
| 172 | next_page = $(this).attr("href"); | 171 | next_page = $(this).attr("href"); | |||
| 173 | }); | 172 | }); | |||
| 174 | $('.infinite-loader .loading').hide(); | 173 | $('.infinite-loader .loading').hide(); | |||
| 175 | if(next_page){ | 174 | if(next_page){ | |||
| 176 | $('.infinite-loader .btn-load-more').show(); | 175 | $('.infinite-loader .btn-load-more').show(); | |||
| 177 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | 176 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | |||
| 178 | if(!loading && next_page){ | 177 | if(!loading && next_page){ | |||
| 179 | loading = true; | 178 | loading = true; | |||
| 180 | self.ajaxInfinite(next_page); | 179 | self.ajaxInfinite(next_page); | |||
| 181 | } | 180 | } | |||
| 182 | }); | 181 | }); | |||
| 183 | } | 182 | } | |||
| 184 | } | 183 | } | |||
| 185 | 184 | |||||
| 186 | }, | 185 | }, | |||
| 187 | error: function () { | 186 | error: function () { | |||
| 188 | window.location.reload(); | 187 | window.location.reload(); | |||
| 189 | } | 188 | } | |||
| 190 | }); | 189 | }); | |||
| 191 | }, | 190 | }, | |||
| 192 | 191 | |||||
| 193 | _create: function () { | 192 | _create: function () { | |||
| 194 | this.initActiveItems(); | 193 | this.initActiveItems(); | |||
| 195 | 194 | |||||
| 196 | this._super(); | 195 | this._super(); | |||
| 197 | 196 | |||||
| 198 | this.initProductListUrl(); | 197 | this.initProductListUrl(); | |||
| 199 | this.initObserve(); | 198 | this.initObserve(); | |||
| 200 | this.initSlider(); | 199 | this.initSlider(); | |||
| 201 | this.initWishlistCompare(); | 200 | this.initWishlistCompare(); | |||
| 202 | this.selectedAttr(); | 201 | this.selectedAttr(); | |||
| 203 | }, | 202 | }, | |||
| 204 | 203 | |||||
| 205 | initActiveItems: function () { | 204 | initActiveItems: function () { | |||
| 206 | var layerActives = this.options.active, | 205 | var layerActives = this.options.active, | |||
| 207 | actives = []; | 206 | actives = []; | |||
| 208 | 207 | |||||
| 209 | if (typeof window.layerActiveTabs !== 'undefined') { | 208 | if (typeof window.layerActiveTabs !== 'undefined') { | |||
| 210 | layerActives = window.layerActiveTabs; | 209 | layerActives = window.layerActiveTabs; | |||
| 211 | } | 210 | } | |||
| 212 | if (layerActives.length) { | 211 | if (layerActives.length) { | |||
| 213 | this.element.find('.filter-options-item').each(function (index) { | 212 | this.element.find('.filter-options-item').each(function (index) { | |||
| 214 | if (~$.inArray($(this).attr('attribute'), layerActives)) { | 213 | if (~$.inArray($(this).attr('attribute'), layerActives)) { | |||
| 215 | actives.push(index); | 214 | actives.push(index); | |||
| 216 | } | 215 | } | |||
| 217 | }); | 216 | }); | |||
| 218 | } | 217 | } | |||
| 219 | 218 | |||||
| 220 | this.options.active = actives; | 219 | this.options.active = actives; | |||
| 221 | 220 | |||||
| 222 | return this; | 221 | return this; | |||
| 223 | }, | 222 | }, | |||
| 224 | 223 | |||||
| 225 | initProductListUrl: function () { | 224 | initProductListUrl: function () { | |||
| 226 | var isProcessToolbar = false, | 225 | var isProcessToolbar = false, | |||
| 227 | isAjax = this.options.isAjax; | 226 | isAjax = this.options.isAjax; | |||
| 228 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | 227 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | |||
| 229 | if (isProcessToolbar) { | 228 | if (isProcessToolbar) { | |||
| 230 | return; | 229 | return; | |||
| 231 | } | 230 | } | |||
| 232 | if (isAjax) { | 231 | if (isAjax) { | |||
| 233 | isProcessToolbar = true; | 232 | isProcessToolbar = true; | |||
| 234 | } | 233 | } | |||
| 235 | 234 | |||||
| 236 | var urlPaths = this.options.url.split('?'), | 235 | var urlPaths = this.options.url.split('?'), | |||
| 237 | baseUrl = urlPaths[0], | 236 | baseUrl = urlPaths[0], | |||
| 238 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | 237 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | |||
| 239 | paramData = {}, | 238 | paramData = {}, | |||
| 240 | parameters; | 239 | parameters; | |||
| 241 | for (var i = 0; i < urlParams.length; i++) { | 240 | for (var i = 0; i < urlParams.length; i++) { | |||
| 242 | parameters = urlParams[i].split('='); | 241 | parameters = urlParams[i].split('='); | |||
| 243 | paramData[parameters[0]] = parameters[1] !== undefined | 242 | paramData[parameters[0]] = parameters[1] !== undefined | |||
| 244 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | 243 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | |||
| 245 | : ''; | 244 | : ''; | |||
| 246 | } | 245 | } | |||
| 247 | paramData[paramName] = paramValue; | 246 | paramData[paramName] = paramValue; | |||
| 248 | if (paramValue === defaultValue) { | 247 | if (paramValue === defaultValue) { | |||
| 249 | delete paramData[paramName]; | 248 | delete paramData[paramName]; | |||
| 250 | } | 249 | } | |||
| 251 | paramData = $.param(paramData); | 250 | paramData = $.param(paramData); | |||
| 252 | if (isAjax) { | 251 | if (isAjax) { | |||
| 253 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | 252 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | |||
| 254 | } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); | 253 | } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); | |||
| 255 | } | 254 | } | |||
| 256 | }, | 255 | }, | |||
| 257 | 256 | |||||
| 258 | initObserve: function () { | 257 | initObserve: function () { | |||
| 259 | var self = this; | 258 | var self = this; | |||
| 260 | var isAjax = this.options.isAjax; | 259 | var isAjax = this.options.isAjax; | |||
| 261 | infinite_loaded_count = 0; | 260 | infinite_loaded_count = 0; | |||
| 262 | 261 | |||||
| 263 | // fix browser back, forward button | 262 | // fix browser back, forward button | |||
| 264 | if (typeof window.history.replaceState === "function") { | 263 | if (typeof window.history.replaceState === "function") { | |||
| 265 | window.history.replaceState({url: document.URL}, document.title); | 264 | window.history.replaceState({url: document.URL}, document.title); | |||
| 266 | 265 | |||||
| 267 | setTimeout(function () { | 266 | setTimeout(function () { | |||
| 268 | window.onpopstate = function (e) { | 267 | window.onpopstate = function (e) { | |||
| 269 | if (e.state) { | 268 | if (e.state) { | |||
| 270 | submitFilterAction(e.state.url, 1); | 269 | submitFilterAction(e.state.url, 1); | |||
| 271 | } | 270 | } | |||
| 272 | }; | 271 | }; | |||
| 273 | }, 0) | 272 | }, 0) | |||
| 274 | } | 273 | } | |||
| 275 | 274 | |||||
| 276 | var pageElements = $('#layer-product-list').find('.pages a'); | 275 | var pageElements = $('#layer-product-list').find('.pages a'); | |||
| 277 | pageElements.each(function () { | 276 | pageElements.each(function () { | |||
| 278 | var el = $(this), | 277 | var el = $(this), | |||
| 279 | link = self.checkUrl(el.prop('href')); | 278 | link = self.checkUrl(el.prop('href')); | |||
| 280 | if (!link) { | 279 | if (!link) { | |||
| 281 | return; | 280 | return; | |||
| 282 | } | 281 | } | |||
| 283 | 282 | |||||
| 284 | el.bind('click', function (e) { | 283 | el.bind('click', function (e) { | |||
| 285 | e.stopPropagation(); | 284 | e.stopPropagation(); | |||
| 286 | e.preventDefault(); | 285 | e.preventDefault(); | |||
| 287 | if (isAjax) { | 286 | if (isAjax) { | |||
| 288 | submitFilterAction(link); | 287 | submitFilterAction(link); | |||
| 289 | } | 288 | } | |||
| 290 | else location.href = link; | 289 | else location.href = link; | |||
| 291 | }) | 290 | }) | |||
| 292 | }); | 291 | }); | |||
| 293 | 292 | |||||
| 294 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | 293 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | |||
| 295 | currentElements.each(function (index) { | 294 | currentElements.each(function (index) { | |||
| 296 | var el = $(this), | 295 | var el = $(this), | |||
| 297 | link = self.checkUrl(el.prop('href')); | 296 | link = self.checkUrl(el.prop('href')); | |||
| 298 | if (!link) { | 297 | if (!link) { | |||
| 299 | return; | 298 | return; | |||
| 300 | } | 299 | } | |||
| 301 | 300 | |||||
| 302 | el.bind('click', function (e) { | 301 | el.bind('click', function (e) { | |||
| 303 | e.stopPropagation(); | 302 | e.stopPropagation(); | |||
| 304 | e.preventDefault(); | 303 | e.preventDefault(); | |||
| 305 | if (isAjax) { | 304 | if (isAjax) { | |||
| 306 | submitFilterAction(link); | 305 | submitFilterAction(link); | |||
| 307 | } | 306 | } | |||
| 308 | else location.href = link; | 307 | else location.href = link; | |||
| 309 | }); | 308 | }); | |||
| 310 | }); | 309 | }); | |||
| 311 | 310 | |||||
| 312 | var optionElements = this.element.find('.filter-options a'); | 311 | var optionElements = this.element.find('.filter-options a'); | |||
| 313 | optionElements.each(function (index) { | 312 | optionElements.each(function (index) { | |||
| 314 | var el = $(this), | 313 | var el = $(this), | |||
| 315 | link = self.checkUrl(el.prop('href')); | 314 | link = self.checkUrl(el.prop('href')); | |||
| 316 | if (!link) { | 315 | if (!link) { | |||
| 317 | return; | 316 | return; | |||
| 318 | } | 317 | } | |||
| 319 | 318 | |||||
| 320 | el.bind('click', function (e) { | 319 | el.bind('click', function (e) { | |||
| 321 | if (el.hasClass('swatch-option-link-layered')) { | 320 | if (el.hasClass('swatch-option-link-layered')) { | |||
| 322 | self.selectSwatchOption(el); | 321 | self.selectSwatchOption(el); | |||
| 323 | } else { | 322 | } else { | |||
| 324 | var checkboxEl = el.siblings(self.options.checkboxEl); | 323 | var checkboxEl = el.siblings(self.options.checkboxEl); | |||
| 325 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | 324 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | |||
| 326 | } | 325 | } | |||
| 327 | 326 | |||||
| 328 | e.stopPropagation(); | 327 | e.stopPropagation(); | |||
| 329 | e.preventDefault(); | 328 | e.preventDefault(); | |||
| 330 | self.ajaxSubmit(link); | 329 | self.ajaxSubmit(link); | |||
| 331 | }); | 330 | }); | |||
| 332 | 331 | |||||
| 333 | var checkbox = el.siblings(self.options.checkboxEl); | 332 | var checkbox = el.siblings(self.options.checkboxEl); | |||
| 334 | checkbox.bind('click', function (e) { | 333 | checkbox.bind('click', function (e) { | |||
| 335 | e.stopPropagation(); | 334 | e.stopPropagation(); | |||
| 336 | self.ajaxSubmit(link); | 335 | self.ajaxSubmit(link); | |||
| 337 | }); | 336 | }); | |||
| 338 | }); | 337 | }); | |||
| 339 | 338 | |||||
| 340 | var swatchElements = this.element.find('.swatch-attribute'); | 339 | var swatchElements = this.element.find('.swatch-attribute'); | |||
| 341 | swatchElements.each(function (index) { | 340 | swatchElements.each(function (index) { | |||
| 342 | var el = $(this); | 341 | var el = $(this); | |||
| 343 | var attCode = el.attr('attribute-code'); | 342 | var attCode = el.attr('attribute-code'); | |||
| 344 | if (attCode) { | 343 | if (attCode) { | |||
| 345 | if (self.options.params.hasOwnProperty(attCode)) { | 344 | if (self.options.params.hasOwnProperty(attCode)) { | |||
| 346 | var attValues = self.options.params[attCode].split(","); | 345 | var attValues = self.options.params[attCode].split(","); | |||
| 347 | var swatchOptions = el.find('.swatch-option'); | 346 | var swatchOptions = el.find('.swatch-option'); | |||
| 348 | swatchOptions.each(function (option) { | 347 | swatchOptions.each(function (option) { | |||
| 349 | var elOption = $(this); | 348 | var elOption = $(this); | |||
| 350 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | 349 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | |||
| 351 | elOption.addClass('selected'); | 350 | elOption.addClass('selected'); | |||
| 352 | } | 351 | } | |||
| 353 | }); | 352 | }); | |||
| 354 | } | 353 | } | |||
| 355 | } | 354 | } | |||
| 356 | }); | 355 | }); | |||
| 357 | 356 | |||||
| 358 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 357 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 359 | requirejs(['jquery', 'weltpixel_quickview' ], | 358 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 360 | function($, quickview) { | 359 | function($, quickview) { | |||
| 361 | $('.weltpixel-quickview').off('click').on('click', function() { | 360 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 362 | var prodUrl = $(this).attr('data-quickview-url'); | 361 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 363 | if (prodUrl.length) { | 362 | if (prodUrl.length) { | |||
| 364 | quickview.displayContent(prodUrl); | 363 | quickview.displayContent(prodUrl); | |||
| 365 | } | 364 | } | |||
| 366 | }); | 365 | }); | |||
| 367 | }); | 366 | }); | |||
| 368 | } | 367 | } | |||
| 369 | 368 | |||||
| 370 | $(".products-grid .weltpixel-quickview").each(function(){ | 369 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 371 | $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); | 370 | $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); | |||
| 372 | }); | 371 | }); | |||
| 373 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | 372 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||
| 374 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | 373 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||
| 375 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | 374 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||
| 376 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 375 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 377 | }); | 376 | }); | |||
| 378 | } | 377 | } | |||
| 379 | if(isAjax) { | 378 | if(isAjax) { | |||
| 380 | self.inFinite(); | 379 | self.inFinite(); | |||
| 381 | }else{ | 380 | }else{ | |||
| 382 | $('.infinite-loader').hide(); | 381 | $('.infinite-loader').hide(); | |||
| 383 | } | 382 | } | |||
| 384 | 383 | |||||
| 385 | }, | 384 | }, | |||
| 386 | 385 | |||||
| 387 | selectSwatchOption: function (el) { | 386 | selectSwatchOption: function (el) { | |||
| 388 | var childEl = el.find('.swatch-option'); | 387 | var childEl = el.find('.swatch-option'); | |||
| 389 | if (childEl.hasClass('selected')) { | 388 | if (childEl.hasClass('selected')) { | |||
| 390 | childEl.removeClass('selected'); | 389 | childEl.removeClass('selected'); | |||
| 391 | } else { | 390 | } else { | |||
| 392 | childEl.addClass('selected'); | 391 | childEl.addClass('selected'); | |||
| 393 | } | 392 | } | |||
| 394 | }, | 393 | }, | |||
| 395 | 394 | |||||
| 396 | initSlider: function () { | 395 | initSlider: function () { | |||
| 397 | var self = this, | 396 | var self = this, | |||
| 398 | slider = this.options.slider; | 397 | slider = this.options.slider, | |||
| 399 | 398 | isAjax = this.options.isAjax; | ||||
| 400 | for (var code in slider) { | 399 | for (var code in slider) { | |||
| 401 | if (slider.hasOwnProperty(code)) { | 400 | if (slider.hasOwnProperty(code)) { | |||
| 402 | var sliderConfig = slider[code], | 401 | var sliderConfig = slider[code], | |||
| 403 | sliderElement = self.element.find(this.options.sliderElementPrefix + code), | 402 | sliderElement = self.element.find(this.options.sliderElementPrefix + code), | |||
| 404 | priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; | 403 | priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; | |||
| 405 | 404 | |||||
| 406 | if (sliderElement.length) { | 405 | if (sliderElement.length) { | |||
| 407 | sliderElement.slider({ | 406 | sliderElement.slider({ | |||
| 408 | range: true, | 407 | range: true, | |||
| 409 | min: sliderConfig.minValue, | 408 | min: sliderConfig.minValue, | |||
| 410 | max: sliderConfig.maxValue, | 409 | max: sliderConfig.maxValue, | |||
| 411 | values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], | 410 | values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], | |||
| 412 | slide: function (event, ui) { | 411 | slide: function (event, ui) { | |||
| 413 | self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); | 412 | self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); | |||
| 414 | }, | 413 | }, | |||
| 415 | change: function (event, ui) { | 414 | change: function (event, ui) { | |||
| 416 | self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); | 415 | self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); | |||
| 417 | } | 416 | } | |||
| 418 | }); | 417 | }); | |||
| 419 | } | 418 | } | |||
| 420 | self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); | 419 | self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); | |||
| 421 | } | 420 | } | |||
| 422 | } | 421 | } | |||
| 423 | }, | 422 | }, | |||
| 424 | 423 | |||||
| 425 | displaySliderText: function (code, from, to, format) { | 424 | displaySliderText: function (code, from, to, format) { | |||
| 426 | var textElement = this.element.find(this.options.sliderTextElementPrefix + code); | 425 | var textElement = this.element.find(this.options.sliderTextElementPrefix + code); | |||
| 427 | if (textElement.length) { | 426 | if (textElement.length) { | |||
| 428 | if (format !== null) { | 427 | if (format !== null) { | |||
| 429 | from = this.formatPrice(from, format); | 428 | from = this.formatPrice(from, format); | |||
| 430 | to = this.formatPrice(to, format); | 429 | to = this.formatPrice(to, format); | |||
| 431 | } | 430 | } | |||
| 432 | 431 | |||||
| 433 | textElement.html(from + ' - ' + to); | 432 | textElement.html(from + ' - ' + to); | |||
| 434 | } | 433 | } | |||
| 435 | }, | 434 | }, | |||
| 436 | 435 | |||||
| 437 | getSliderUrl: function (url, from, to) { | 436 | getSliderUrl: function (url, from, to) { | |||
| 438 | return url.replace('from-to', from + '-' + to); | 437 | return url.replace('from-to', from + '-' + to); | |||
| 439 | }, | 438 | }, | |||
| 440 | 439 | |||||
| 441 | formatPrice: function (value, format) { | 440 | formatPrice: function (value, format) { | |||
| 442 | return ultil.formatPrice(value, format); | 441 | return ultil.formatPrice(value, format); | |||
| 443 | }, | 442 | }, | |||
| 444 | 443 | |||||
| 445 | ajaxSubmit: function (submitUrl) { | 444 | ajaxSubmit: function (submitUrl) { | |||
| 446 | var isAjax = this.options.isAjax; | 445 | var isAjax = this.options.isAjax; | |||
| 447 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | 446 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | |||
| 448 | ||||||
| 449 | if (isAjax) { | 447 | if (isAjax) { | |||
| 450 | return submitFilterAction(submitUrl); | 448 | return submitFilterAction(submitUrl); | |||
| 451 | } | 449 | } | |||
| 452 | location.href = submitUrl; | 450 | location.href = submitUrl; | |||
| 453 | }, | 451 | }, | |||
| 454 | 452 | |||||
| 455 | checkUrl: function (url) { | 453 | checkUrl: function (url) { | |||
| 456 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | 454 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | |||
| 457 | ||||||
| 458 | return regex.test(url) ? url : null; | 455 | return regex.test(url) ? url : null; | |||
| 459 | }, | 456 | }, | |||
| 460 | 457 | |||||
| 461 | //Handling 'add to wishlist' & 'add to compare' event | 458 | //Handling 'add to wishlist' & 'add to compare' event | |||
| 462 | initWishlistCompare: function () { | 459 | initWishlistCompare: function () { | |||
| 463 | var isAjax = this.options.isAjax; | 460 | var isAjax = this.options.isAjax; | |||
| 464 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | 461 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | |||
| 465 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | 462 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | |||
| 466 | $(elClass).each(function () { | 463 | $(elClass).each(function () { | |||
| 467 | var el = $(this); | 464 | var el = $(this); | |||
| 468 | $(el).bind('click', function (e) { | 465 | $(el).bind('click', function (e) { | |||
| 469 | var dataPost = $(el).data('post'), | 466 | var dataPost = $(el).data('post'), | |||
| 470 | formKey = $('input[name="form_key"]').val(); | 467 | formKey = $('input[name="form_key"]').val(); | |||
| 471 | if (formKey) { | 468 | if (formKey) { | |||
| 472 | dataPost.data.form_key = formKey; | 469 | dataPost.data.form_key = formKey; | |||
| 473 | } | 470 | } | |||
| 474 | 471 | |||||
| 475 | var paramData = $.param(dataPost.data), | 472 | var paramData = $.param(dataPost.data), | |||
| 476 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | 473 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | |||
| 477 | 474 | |||||
| 478 | e.stopPropagation(); | 475 | e.stopPropagation(); | |||
| 479 | e.preventDefault(); | 476 | e.preventDefault(); | |||
| 480 | 477 | |||||
| 481 | if (isAjax && el.hasClass('towishlist')) { | 478 | if (isAjax && el.hasClass('towishlist')) { | |||
| 482 | submitFilterAction(url, true); | 479 | submitFilterAction(url, true); | |||
| 483 | } else if (isAjax) { | 480 | } else if (isAjax) { | |||
| 484 | submitFilterAction(url); | 481 | submitFilterAction(url); | |||
| 485 | } else location.href = url; | 482 | } else location.href = url; | |||
| 486 | }); | 483 | }); | |||
| 487 | }) | 484 | }) | |||
| 488 | }, | 485 | }, | |||
| 489 | 486 | |||||
| 490 | //Selected attribute color after page load. | 487 | //Selected attribute color after page load. | |||
| 491 | selectedAttr: function () { | 488 | selectedAttr: function () { | |||
| 492 | var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); | 489 | var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); | |||
| 493 | 490 | |||||
| 494 | filterCurrent.each(function(){ | 491 | filterCurrent.each(function(){ | |||
| 495 | var el = $(this), | 492 | var el = $(this), | |||
| 496 | colorLabel = el.html(), | 493 | colorLabel = el.html(), | |||
| 497 | colorAttr = $('.filter-options .filter-options-item .color .swatch-option-link-layered .swatch-option'); | 494 | colorAttr = $('.filter-options .filter-options-item .color .swatch-option-link-layered .swatch-option'); | |||
| 498 | 495 | |||||
| 499 | colorAttr.each(function(){ | 496 | colorAttr.each(function(){ | |||
| 500 | var elA = $(this); | 497 | var elA = $(this); | |||
| 501 | if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ | 498 | if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ | |||
| 502 | elA.addClass('selected'); | 499 | elA.addClass('selected'); | |||
| 503 | } | 500 | } | |||
| 504 | }); | 501 | }); | |||
| 505 | }); | 502 | }); | |||
| 506 | } | 503 | } | |||
| 507 | }); | 504 | }); | |||
| 508 | 505 | |||||
| 509 | return $.mageplaza.layer; | 506 | return $.mageplaza.layer; | |||
| 510 | }); | 507 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.